//
//  MusicCollectionViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MusicCollectionViewCell.h"


@implementation MusicCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.likeLabel = [[UILabel alloc] init];

        [self.contentView addSubview:self.likeLabel];
        
        self.recommendLabel = [[UILabel alloc] init];

        [self.contentView addSubview:self.recommendLabel];
        
//        self.playbutton = [[UIButton alloc] init];

//        [self.contentView addSubview:self.playbutton];
        
//        UITapGestureRecognizer *likeTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapAction)];
//        UITapGestureRecognizer *recommendTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapAction)];
//       
//        
//        [self.likeLabel addGestureRecognizer:likeTap];
//        [self.recommendLabel addGestureRecognizer:recommendTap];
//        
        
    }
    return self;
}

//- (void)imageTapAction
//{
//    
//}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    self.likeLabel.frame = CGRectMake(15, 20 * FitWidth, layoutAttributes.size.width - 40, layoutAttributes.size.height - 70);

    self.recommendLabel.frame = CGRectMake(10, layoutAttributes.size.height - 40, layoutAttributes.size.width - 40, layoutAttributes.frame.size.height - 70);
    
   
    
    self.playbutton.frame = CGRectMake(150 * FitWidth, 40 * FitWidth, 20 * FitWidth, 20 * fitHeight);
    self.playbutton.layer.cornerRadius = 10;
    [self.playbutton addTarget:self action:@selector(playbuttonAction) forControlEvents:UIControlEventTouchUpInside];

}
- (void)setNewCellModel:(MusicSmallModel *)NewCellModel
{
    _NewCellModel = NewCellModel;
    self.likeLabel.text = [NSString stringWithFormat:@"%@",_NewCellModel.name];
    self.recommendLabel.text = [NSString stringWithFormat:@"%@",_NewCellModel.desc];
    self.recommendLabel.font = [UIFont systemFontOfSize:14];
    [self.playbutton setBackgroundImage:[UIImage imageNamed:@"播放"] forState:UIControlStateNormal];
    
}
// 点击播放
- (void)playbuttonAction
{
    
}

@end
